package seven.test_7_7;

import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        int count = 0;
        for (int i = l; i <= r; i++) {
            count += getTwos(i);
        }
        System.out.println(count);
    }
    private static int getTwos(int n) {
        int count = 0;
        while (n > 0) {
            int tmp = n % 10;
            if(tmp == 2) {
                count++;
            }
            n /= 10;
        }
        return count;
    }
}
